package mylibrary.io.jichu.pipeStream;

import java.io.PipedInputStream;

public class Receiver implements Runnable{

	private PipedInputStream input = null;
	
	public Receiver() {
		this.input = new PipedInputStream();
	}
	
	public PipedInputStream getInput() {
		return this.input;
	}
	
	public void run() {
		byte[] b = new byte[1024];
		
		int len = 0;
		
		try {
			len = this.input.read(b);	
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		try {
			input.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		System.out.println("The receiver content is " + new String(b, 0, len));
	}
}
